package com.itheima.com.itheima.controller;

import com.itheima.feign.UserFeignApi;
import com.itheima.pojo.User;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class FeignController {
    @Reference
    private UserFeignApi userFeignApi;
//    根据id查询用户信息
    @GetMapping("/{id}")
    public User queryById(@PathVariable("id") Long id){
        return userFeignApi.findById(id);
    }
}
